package com.keter.framework.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.List;

/**
 * 初始化配置:使调用方无需包扫描条件下Autowired自动生效
 */
@Configuration
@ComponentScan(basePackages = {"com.keter.framework.web.component"})
public class AutoConfiguration {

    @Autowired
    HandlerMethodArgumentResolver sidHandlerMethodArgumentResolver;

    @Configuration
    class WebAppConfigurer implements WebMvcConfigurer {
        /**
         * 使SID注解生效
         * @param resolvers
         */
        @Override
        public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) {
            resolvers.add(sidHandlerMethodArgumentResolver);
        }
    }

}
